if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
    add_definitions(-DDEBUG_BUILD)
elseif (${CMAKE_BUILD_TYPE} MATCHES "Release")
    add_definitions(-DRELEASE_BUILD)
else()
    message(WARNING "Unknown build type: ${CMAKE_BUILD_TYPE}")
endif()

add_definitions(-DSPDLOG_USE_STD_FORMAT)

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    message(STATUS "Using MSVC compiler.")
    # 这里添加针对MSVC的特定设置
    # 根据构建类型设置不同的编译选项
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        # 调试构建
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /Ob0 /Od /RTC1")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi /Ob0 /Od /RTC1")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG" )
        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
        add_definitions(-D_DEBUG)
    else()
        # 发布构建
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /DNDEBUG")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Ob2 /DNDEBUG")
        add_definitions(-DNDEBUG)
    endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
    message(STATUS "Using GNU compiler.")
    # 这里添加针对GNU的特定设置
    if(CMAKE_BUILD_TYPE MATCHES Debug)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
        add_definitions(-D_DEBUG)
    else()
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
        add_definitions(-DNDEBUG)
    endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    message(STATUS "Using Clang compiler.")
    if(CMAKE_BUILD_TYPE MATCHES Debug)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
        add_definitions(-D_DEBUG)
    else()
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
        add_definitions(-DNDEBUG)
    endif()
    # 这里添加针对Clang的特定设置
else()
    message(STATUS "Unknown compiler.")
    # 这里处理未知或不支持的编译器
endif()